import 'package:flutter/material.dart';
import './myFonts.dart';

//ListView列表组件
void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('ListView列表组件 '),
          backgroundColor: Colors.pink[50],
        ),
        body: MyHomePage(),
      ),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return ListView(
      padding: EdgeInsets.all(10),
      scrollDirection: Axis.vertical, //vertical垂直/horizontal水平
      children: [
        Image.network('https://www.itying.com/images/flutter/1.png'),
        Container(
          //sizedBox 比 container 更加轻量级  属性少
          height: 44,
          padding: EdgeInsets.fromLTRB(0, 6, 0, 0),
          child: Text(
            '我是一个标题',
            textAlign: TextAlign.center,
            style: TextStyle(fontSize: 22),
          ),
        ),
        Image.network('https://www.itying.com/images/flutter/2.png'),
        Container(
          //sizedBox 比 container 更加轻量级  属性少
          height: 44,
          padding: EdgeInsets.fromLTRB(0, 6, 0, 0),
          child: Text(
            '我是一个标题',
            textAlign: TextAlign.center,
            style: TextStyle(fontSize: 22),
          ),
        ),
        Image.network('https://www.itying.com/images/flutter/3.png'),
        Container(
          //sizedBox 比 container 更加轻量级  属性少
          height: 44,
          padding: EdgeInsets.fromLTRB(0, 6, 0, 0),
          child: Text(
            '我是一个标题',
            textAlign: TextAlign.center,
            style: TextStyle(fontSize: 22),
          ),
        ),
        Image.network('https://www.itying.com/images/flutter/4.png'),
        Container(
          //sizedBox 比 container 更加轻量级  属性少
          height: 44,
          padding: EdgeInsets.fromLTRB(0, 6, 0, 0),
          child: Text(
            '我是一个标题',
            textAlign: TextAlign.center,
            style: TextStyle(fontSize: 22),
          ),
        ),
        Image.network('https://www.itying.com/images/flutter/5.png'),
        Container(
          //sizedBox 比 container 更加轻量级  属性少
          height: 44,
          padding: EdgeInsets.fromLTRB(0, 6, 0, 0),
          child: Text(
            '我是一个标题',
            textAlign: TextAlign.center,
            style: TextStyle(fontSize: 22),
          ),
        ),
        Image.network('https://www.itying.com/images/flutter/6.png'),
      ],
    );
  }
}
